package com.yang.api.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Map;
import java.util.Set;

/**
 * @author yangyongsheng
 * @date 2024/6/23 22:42
 * @description  beacon-cache远程调用客户端
 */
@FeignClient("beacon-cache")//属性要和spring.application.name对应
public interface BeaconCacheClient {
    //方法重载，让openfeign去帮忙转换
    @PostMapping("/cache/get/{key}")
    String getString(@PathVariable(value = "key") String key);

    @GetMapping("/cache/hgetall/{key}")
    Map hGetAll(@PathVariable(value = "key")String key);

    @GetMapping("/cache/hget/{key}/{field}")
    Object hget(@PathVariable(value = "key")String key,@PathVariable(value = "field")String field);

    @GetMapping("/cache/hget/{key}/{field}")
    Long hgetLong(@PathVariable(value = "key")String key,@PathVariable(value = "field")String field);

    //方法重载，让openfeign去帮忙转换
    @GetMapping("/cache/hget/{key}/{field}")
    String hgetString(@PathVariable(value = "key")String key,@PathVariable(value = "field")String field);

    @GetMapping("/cache/smember/{key}")
    Set<Map> smember(@PathVariable(value = "key")String key);
}
